package com.eqdd.yiqidian.utils;

import android.os.Bundle;

import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.eqdd.yiqidian.base.AppConstent;
import com.eqdd.yiqidian.base.BaseActivity;
import com.eqdd.yiqidian.base.Config;
import com.eqdd.yiqidian.bean.User;
import com.eqdd.yiqidian.http.HttpConfig;
import com.eqdd.yiqidian.http.HttpResult;
import com.eqdd.yiqidian.http.JsonCallBack;
import com.eqdd.yiqidian.ui.LoginActivity;
import com.eqdd.yiqidian.ui.MineAuActivity;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;

import java.util.HashMap;

/**
 * Created by lv on 17-9-11.
 */

public class LoginInterceptor {


    private static String[] greenDaos = new String[]{
            "SplashActivity",
            "LoginActivity",
            "RegistTwo",
            "RegistActivity",
            "PhonePasswordGetActivity",
            "GuideActivity",
            "GetPwdSendCheckCodeActivity",
            "EmailPasswordGetActivity",
            "EmailCheckActivity",
            "AreaActivity",
            "WebActivity",
            "DakaActivity"
    };


    public static void interceptor(BaseActivity activity, String clazz, OnInterceptor onInterceptor) {

        for (String greenDao : greenDaos) {
            if (clazz.contains(greenDao)) {
                onInterceptor.go(null);
                return;
            }
        }
        login(activity);
    }

    private static void login(BaseActivity activity) {
        Bundle bundle = new Bundle();
        bundle.putBoolean(Config.IS_NOTIFICATION,true);
        activity.startActivityForResult(LoginActivity.class, bundle, Config.LOGIN);
    }

    public interface OnInterceptor {
        void go(Bundle bundle);
    }
}
